CC:=gcc
LD=ld
RM=rm

ENV_SUPPORT=1

CFLAGS=-g -Wall
LDFLAGS=-g -lc

DIAG_OBJS=main.o \
	cmd.o \
	do_sys.o \
	do_mp.o

ifeq ($(ENV_SUPPORT),1)
CFLAGS+=-DENV_SUPPORT
DIAG_OBJS+=var.o do_env.o
endif

.PHONY: clean
all: diag
diag: $(DIAG_OBJS)
	$(CC) $(LDFLAGS) -o $@ $^

clean:
	$(RM) -rfv *.out *.exe *.stackdump $(DIAG_OBJS) diag

%.o.%.c:
	$(CC) $(CFLAGS) -c $<
